<?php
	//Inclusion du haut de la page :
	require "./require/php_require.php";
	
	//si il n'y a pas de paramètres, on créé une ligne en base et on redirige :
	if(!isset($_GET['id']))
	{
		//Créer le dossier de la vidéo :
        $randfolder="v".rand(1000000000, 9999999999);
       
        /* si le dossier existe déjà*/
       
       
        /*création des dossiers*/
       
        $dossiervideo = "./data/video/video/fichiervideos/".$randfolder;
        $dossiersrt =  "./data/video/soustitre/fichiersrt/".$randfolder;
        mkdir($dossiervideo.'/',7777);// attention aux droits
        mkdir($dossiersrt.'/',7777);
        //Création d'une nouvelle ligne video en base :
        ajoutVideo($randfolder);
        //Création d'une nouvelle ligne srt en base :   
           
        //Redirection sur la même page avec l'id de la vidéo ajouté
        $_GET['id']=$randfolder;
        redirection('./edit_video.php?id='.$randfolder);
	}
	
	//On eneleve le sommaire :
	$sommaire = false;
	
	$title = "Template"; include "./include/doctype_top.php";
	
	//Styles CSS conditionn�s :
	echo '<link href="./css/gestion_video.css" rel="stylesheet">';
	echo '<link href="./css/vignette.css" rel="stylesheet">';
	echo '<link href="./css/formulaire_video.css" rel="stylesheet">';
	echo '<link href="./css/exercice.css" rel="stylesheet">';
	
	//Plugins JS :
	echo '<script src="./javascript/jquery/jquery.template.js" type="text/javascript"></script>';
	
	//Inclusion plugin upload :
?>
	<!-- Generic page styles -->

	<!-- Bootstrap styles for responsive website layout, supporting different screen sizes -->

	<!-- Bootstrap CSS fixes for IE6 -->
	<!--[if lt IE 7]><link rel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap-ie6.min.css"><![endif]-->
	<!-- Bootstrap Image Gallery styles -->
	<link rel="stylesheet" href="./framework/fileupload/css/bootstrap-image-gallery.min.css">
	<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
	<link rel="stylesheet" href="./framework/fileupload/css/jquery.fileupload-ui.css">
	<!-- CSS adjustments for browsers with JavaScript disabled -->
	<noscript><link rel="stylesheet" href="./framework/fileupload/css/jquery.fileupload-ui-noscript.css"></noscript>
	<!-- Shim to make HTML5 elements usable in older Internet Explorer versions -->
	<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->

	
	<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
	<script src="./framework/fileupload/js/vendor/jquery.ui.widget.js"></script>
	<!--Le plugin qui permet d'utiliser des templates jquery donc generation de code automatique -->
	<script src="./framework/fileupload/js/tmpl.min.js"></script>
	<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
	<script src="./framework/fileupload/js/load-image.min.js"></script>
	<!-- The Canvas to Blob plugin is included for image resizing functionality -->
	<script src="./framework/fileupload/js/canvas-to-blob.min.js"></script>
	<!-- Bootstrap JS and Bootstrap Image Gallery are not required, but included for the demo -->

	<script src="./framework/fileupload/js/bootstrap-image-gallery.min.js"></script>
	<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
	<script src="./framework/fileupload/js/jquery.iframe-transport.js"></script>
	<!-- The basic File Upload plugin -->
	<script src="./framework/fileupload/js/jquery.fileupload.js"></script>
	<!-- The File Upload file processing plugin -->
	<script src="./framework/fileupload/js/jquery.fileupload-fp.js"></script>
	<!-- The File Upload user interface plugin -->
	<script src="./framework/fileupload/js/jquery.fileupload-ui.js"></script>
	
	<!-- The main application script -->
	<script src="./framework/fileupload/js/main.js"></script>
	<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->
	<!--[if gte IE 8]><script src="js/cors/jquery.xdr-transport.js"></script><![endif]-->
<?php
	include "./include/doctype_bottom.php";

	//Inclusion des pages conditionn�es (en fonction membre/admin par exemple) contenant les JS :
	include "./page/edit_video.php";
	
	//Inclusion du footer :
	include "./include/footer.php";
	
	//Scripts javascript � conditionner :
	//echo '<script src="./javascript/template.js" type="text/javascript"></script>';
	
	//Fermeture :
	include "./include/closure.php";
?>